package com.example.demo.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    @Bean
    public Queue emailQueue() { return new Queue("que"); }

    @Bean
    public DirectExchange emailExchange() { return new DirectExchange("ex"); }

    @Bean
    public Binding binding() {
        return BindingBuilder.bind(emailQueue()).to(emailExchange()).with("email");
    }
    @Bean
    public Jackson2JsonMessageConverter jsonMessageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
